package com.lizhen.behaviorpattern.commmandpattern;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Broker {
    private List<Order> orderList = new ArrayList();

    public Broker() {
    }

    public void takeOrder(Order order) {
        this.orderList.add(order);
    }

    public void placeOrders() {
        Iterator var2 = this.orderList.iterator();

        while (var2.hasNext()) {
            Order order = (Order) var2.next();
            order.execute();
        }

        this.orderList.clear();
    }
}
